package com.jt.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author Song
 * @since 2020/11/3
 */
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class SysResult {

    private Integer status;
    private String  msg;
    private Object  data;

    public static SysResult fail(){
        return new SysResult(201, "业务执行失败", null);
    }

    /**
     *  1.只需要返回状态码信息   200
     *  2.需要返状态及业务数据   200/data
     *  3.返回提示信息/data业务数据
     * @return
     */
    public static SysResult success(){

        return new SysResult(200, "业务执行成功!", null);
    }

    public static SysResult success(Object data){

        return new SysResult(200, "业务执行成功!", data);
    }

    /**
     * 只想返回提示信息
     * @param msg
     * @param data
     * @return
     */
    public static SysResult success(String msg,Object data){

        return new SysResult(200, msg, data);
    }
}
